package com.chinackts.proceedspayment.exportproceeds.controller;

import com.alibaba.fastjson.JSONObject;
import com.chinackts.proceedspayment.exportproceeds.dto.ExportProceedsListDto;
import com.chinackts.proceedspayment.exportproceeds.query.ExportProceedsListQuery;
import com.chinackts.proceedspayment.exportproceeds.query.ExportProceedsPageQuery;
import com.chinackts.proceedspayment.exportproceeds.service.ExportProceedsService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author Lianhong
 * @since 2021/11/18
 */
@RestController
public class ExportProceedsController implements ExportProceedsControllerInterface {

    @Resource
    private ExportProceedsService exportProceedsService;

    @Override
    public ResponseEntity<ExportProceedsListDto> list(String id, ExportProceedsListQuery query) {
        return ResponseEntity.ok(exportProceedsService.list(id, query));
    }

    @Override
    public ResponseEntity<ExportProceedsListDto> pageList(String id, ExportProceedsPageQuery query) {
        return ResponseEntity.ok(exportProceedsService.pageList(id, query));
    }

    @Override
    public ResponseEntity<JSONObject> details(String id, String entryId, boolean regather) {
        return ResponseEntity.ok(exportProceedsService.details(id, entryId, regather));
    }

    @Override
    public ResponseEntity<Void> exportProceedsPdf(String id, List<String> entryIds, HttpServletResponse response) {
        exportProceedsService.exportProceedsPdf(id, entryIds, response);
        return ResponseEntity.noContent().build();
    }
}
